from ui.components.base.widget import TgBaseWidget
from ui.components.layouts.vbox_layout import TgVBoxLayout
from ui.components.containers.tab_widget import TgTabWidget
from ui.components.containers.scroll_area import TgScrollArea
from .views.single_variety_backtesting_view import (
    SingleVarietyBacktestingView as SingleVarietyBacktestingTab,
)
from .views.settings_tab import SettingsTab


class FuturesBacktestingWidget(TgBaseWidget):
    def __init__(self):
        super().__init__()
        
        # 创建 Tab 控件
        self.tabs = TgTabWidget()
        self.single_variety_tab = SingleVarietyBacktestingTab()
        self.settings_tab = SettingsTab()

        # Wrap the single variety tab in a scroll area
        scroll_area = TgScrollArea()
        scroll_area.setWidget(self.single_variety_tab)
        scroll_area.setWidgetResizable(True)
        
        self.tabs.addTab(scroll_area, "单品种回测")
        self.tabs.addTab(self.settings_tab, "设置")
        
        TgVBoxLayout(self).addWidget(self.tabs)